Day 14 - Regular expressions - Classes

Solutions to exercises

Exercise 14.07

Match any line of examples.txt containing a digit

Solution

$ cat examples.txt | grep "[0-9]"

Police 101

H2O

007

R2-D2

Johnny 5

Cyborg 009

HTTP/1.1

C-3PO

Go back to the exercise

Exercise 14.08

Match any line of examples.txt containing a lowercase “a” followed by any letter (that is “aa”, “ab”,

“ac”, and so on)

Solution